package com.zjty.service;

import java.util.concurrent.TimeUnit;

import javax.annotation.Resource;

import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;

@Service
public class RedisServiceImpl implements RedisService {

	@Resource
	private RedisTemplate<String, Object> redisTemplate;

	@Override
	public void setStr(String key, String value) {

	}

	@Override
	public void setCode(String userPhone, int code, long timeout) {
		redisTemplate.opsForValue().set(userPhone, userPhone, timeout, TimeUnit.MINUTES);
	}

	@Override
	public String getStr(String key) {
		return (String) redisTemplate.opsForValue().get(key);
	}

	@Override
	public int getCode(String userPhone) {
		return (int) redisTemplate.opsForValue().get(userPhone);
	}

	@Override
	public void rPushList(String key, String value) {
		// TODO Auto-generated method stub

	}

	@Override
	public String lPopList(String key) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public void delKey(String key) {
		// TODO Auto-generated method stub

	}

}
